package crack.lshape.mesh7;

import java.io.IOException;

import math2.MathUtilities;
import fem2.AbstractStructuralCrackDemo;
import fem2.Element;
import fem2.MaterialModel;
import fem2.MeshPart;
import fem2.Model;
import fem2.element.crack_sda.SKONConstantJumpCSTElementUsingRecoverStress;
import fem2.enu.State;
import fem2.material.StVenantKirchhoffMM;
import fem2.material.SPRrecoveryMM;
import fem2.material.cohesive_law.CohesiveLaw;

public class LshapeMesh7SKONConstantJumpCSTElementRecover2AndJirasekExponentialCohesiveLaw extends
		LshapeMesh7SKONConstantJumpCSTElementAndJirasekExponentialCohesiveLaw {

	public LshapeMesh7SKONConstantJumpCSTElementRecover2AndJirasekExponentialCohesiveLaw() {
		meshFileName = "mesh7-skon-recover2-jirasek.msh";
	}

	@Override
	public Element createElement(MeshPart mp, MaterialModel mm, CohesiveLaw cl) {
		Element e = new SKONConstantJumpCSTElementUsingRecoverStress(mp, mm, cl);
		return e;
	}

	@Override
	public MaterialModel createMaterial(Model m) {
		double E = 25850;
		double nu = 0.18;
		double t = 200;
		State ss = State.PLANE_STRESS;
		MaterialModel mm = new SPRrecoveryMM(m, new StVenantKirchhoffMM(E, nu, t, 0, ss));
		return mm;
	}

	public static void main(String[] args) throws IOException {

		AbstractStructuralCrackDemo sample = new LshapeMesh7SKONConstantJumpCSTElementRecover2AndJirasekExponentialCohesiveLaw();

		// double[] lambda = MyLinAlg.createLambdaArray(13.6, 0.1, 13.7);
		// double[] lambda = MyLinAlg.createLambdaArray(13.6, 0.1, 30);
		double[] lambda = MathUtilities.createLambdaArray(13.6, 0.1, 40); // not
																			// a
																			// very
																			// good
																			// result,
																			// crack
																			// bang
																			// to
																			// other
																			// direction

		sample.run(lambda);

	}
}
